import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FilesVO, FilesForm, FilesQuery } from '@/api/llm/files/types';

/**
 * 查询上传文件列表
 * @param query
 * @returns {*}
 */

export const listFiles = (query?: FilesQuery): AxiosPromise<FilesVO[]> => {
  return request({
    url: '/llm/files/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询上传文件详细
 * @param id
 */
export const getFiles = (id: string | number): AxiosPromise<FilesVO> => {
  return request({
    url: '/llm/files/' + id,
    method: 'get'
  });
};

/**
 * 新增上传文件
 * @param data
 */
export const addFiles = (data: FilesForm) => {
  return request({
    url: '/llm/files',
    method: 'post',
    data: data
  });
};

/**
 * 修改上传文件
 * @param data
 */
export const updateFiles = (data: FilesForm) => {
  return request({
    url: '/llm/files',
    method: 'put',
    data: data
  });
};

/**
 * 删除上传文件
 * @param id
 */
export const delFiles = (id: string | number | Array<string | number>) => {
  return request({
    url: '/llm/files/' + id,
    method: 'delete'
  });
};
